class CreateVariants < ActiveRecord::Migration
  def change
    create_table :product_variants, :force => true do |t|
      t.references :product, :null => false
      t.string  :number, :limit => 30, :null => true
      t.decimal :price, :precision => 10, :scale => 2, :null => true, :default => "0.00"
      t.boolean :is_master, :default => false
      t.string  :state, :limit => 15, :default => "on_sale"
      t.datetime :deleted_at, :null => true
      t.timestamps
    end

    add_index :product_variants, :product_id
    add_index :product_variants, :number
  end
end
